home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-in_the_mag-
/
reader_requests
/
scilab
/
demos
/
npend
/
maple
/
npend.f
< prev
next >
Wrap
Text File
|
1999-09-16
|
13KB
|
418 lines
c
c SUBROUTINE npend
c
subroutine npend(neq,t,th,ydot)
parameter (n=10)
implicit doubleprecision (t)
doubleprecision t,th(2*n),ydot(2*n),r(n),j(n),m(n)
doubleprecision me3s(n,n),cc3s(n,n),const(n,1)
doubleprecision w(3*n),rcond
integer i,k,neq,ierr
data g / 9.81/
data r / n*1.0/
data m / n*1.0/
data j / n*0.3/
t1 = -th(9)
t4 = 2*m(10)
t5 = m(9)+t4
t9 = 2*r(7)*r(9)*cos(th(7)+t1)*t5
t15 = 2*r(3)*r(9)*cos(th(3)+t1)*t5
t16 = -th(8)
t19 = 2*m(9)
t20 = m(8)+t4+t19
t24 = 2*r(7)*r(8)*cos(th(7)+t16)*t20
t25 = r(2)**2
t44 = -th(6)
t47 = 2*m(7)
t48 = 2*m(8)
t49 = m(6)+t19+t4+t47+t48
t53 = 2*r(5)*r(6)*cos(th(5)+t44)*t49
t59 = 2*r(6)*r(9)*cos(th(6)+t1)*t5
t60 = -th(10)
t66 = 2*r(5)*m(10)*r(10)*cos(th(5)+t60)
t72 = 2*r(1)*r(8)*cos(th(1)+t16)*t20
t73 = -th(4)
t76 = 2*m(5)
t77 = 2*m(6)
t78 = t48+m(4)+t19+t76+t47+t4+t77
t82 = 2*r(3)*r(4)*cos(th(3)+t73)*t78
t88 = 2*r(8)*r(9)*cos(th(8)+t1)*t5
t89 = r(5)**2
t102 = -th(7)
t105 = t4+m(7)+t48+t19
t109 = 2*r(6)*r(7)*cos(th(6)+t102)*t105
t115 = 2*r(9)*m(10)*r(10)*cos(th(9)+t60)
t116 = r(3)**2
t138 = 2*r(4)*r(9)*cos(th(4)+t1)*t5
t144 = 2*r(3)*m(10)*r(10)*cos(th(3)+t60)
t150 = 2*r(4)*m(10)*r(10)*cos(th(4)+t60)
t151 = -th(3)
t154 = 2*m(4)
t155 = t76+t154+t4+t48+t47+m(3)+t19+t77
t159 = 2*r(1)*r(3)*cos(th(1)+t151)*t155
t160 = r(8)**2
t167 = r(6)**2
t183 = 2*r(6)*m(10)*r(10)*cos(th(6)+t60)
t184 = r(10)**2
t192 = 2*r(2)*r(4)*cos(th(2)+t73)*t78
t193 = r(9)**2
t198 = r(7)**2
t212 = 2*r(3)*r(6)*cos(th(3)+t44)*t49
t218 = 2*r(2)*r(3)*cos(th(2)+t151)*t155
t224 = 2*r(5)*r(9)*cos(th(5)+t1)*t5
t230 = 2*r(5)*r(7)*cos(th(5)+t102)*t105
t236 = 2*r(7)*m(10)*r(10)*cos(th(7)+t60)
t242 = 2*r(1)*r(4)*cos(th(1)+t73)*t78
t248 = 2*r(1)*r(6)*cos(th(1)+t44)*t49
t254 = 2*r(2)*r(6)*cos(th(2)+t44)*t49
t260 = 2*r(2)*m(10)*r(10)*cos(th(2)+t60)
t266 = 2*r(8)*m(10)*r(10)*cos(th(8)+t60)
t267 = -th(5)
t270 = t77+t48+t19+t47+m(5)+t4
t274 = 2*r(1)*r(5)*cos(th(1)+t267)*t270
t280 = 2*r(4)*r(5)*cos(th(4)+t267)*t270
t286 = 2*r(4)*r(7)*cos(th(4)+t102)*t105
t292 = 2*r(6)*r(8)*cos(th(6)+t16)*t20
t298 = 2*r(1)*r(9)*cos(th(1)+t1)*t5
t304 = 2*r(5)*r(8)*cos(th(5)+t16)*t20
t310 = 2*r(3)*r(5)*cos(th(3)+t267)*t270
t316 = 2*r(3)*r(7)*cos(th(3)+t102)*t105
t322 = 2*r(2)*r(7)*cos(th(2)+t102)*t105
t331 = 2*r(1)*r(2)*cos(th(1)-th(2))*(2*m(3)+m(2)+t154+t47+t4+t76+t
+77+t19+t48)
t332 = r(4)**2
t352 = 2*r(4)*r(8)*cos(th(4)+t16)*t20
t358 = 2*r(2)*r(5)*cos(th(2)+t267)*t270
t364 = 2*r(2)*r(9)*cos(th(2)+t1)*t5
t370 = 2*r(2)*r(8)*cos(th(2)+t16)*t20
t376 = 2*r(1)*r(7)*cos(th(1)+t102)*t105
t382 = 2*r(3)*r(8)*cos(th(3)+t16)*t20
t388 = 2*r(4)*r(6)*cos(th(4)+t44)*t49
t389 = r(1)**2
t417 = 2*r(1)*m(10)*r(10)*cos(th(1)+t60)
me3s(9,7) = t9
me3s(3,9) = t15
me3s(8,7) = t24
me3s(2,2) = J(2)+4*t25*m(3)+4*t25*m(4)+4*t25*m(7)+4*t25*m(8)+m(
+2)*t25+4*t25*m(9)+4*t25*m(5)+4*t25*m(10)+4*t25*m(6)
me3s(6,5) = t53
me3s(9,6) = t59
me3s(10,5) = t66
me3s(8,1) = t72
me3s(4,3) = t82
me3s(9,8) = t88
me3s(5,5) = 4*t89*m(8)+4*t89*m(10)+4*t89*m(7)+4*t89*m(9)+4*t89*
+m(6)+J(5)+m(5)*t89
me3s(7,6) = t109
me3s(10,9) = t115
me3s(3,3) = 4*t116*m(4)+4*t116*m(10)+4*t116*m(9)+4*t116*m(5)+4*
+t116*m(6)+m(3)*t116+J(3)+4*t116*m(7)+4*t116*m(8)
me3s(4,9) = t138
me3s(3,10) = t144
me3s(10,4) = t150
me3s(3,1) = t159
me3s(8,8) = 4*t160*m(9)+J(8)+m(8)*t160+4*t160*m(10)
me3s(6,6) = m(6)*t167+4*t167*m(7)+4*t167*m(8)+J(6)+4*t167*m(9)+
+4*t167*m(10)
me3s(10,6) = t183
me3s(10,10) = m(10)*t184+J(10)
me3s(4,2) = t192
me3s(9,9) = 4*t193*m(10)+J(9)+m(9)*t193
me3s(7,7) = 4*t198*m(9)+4*t198*m(10)+4*t198*m(8)+J(7)+m(7)*t198
me3s(6,3) = t212
me3s(3,2) = t218
me3s(10,3) = t144
me3s(9,5) = t224
me3s(7,5) = t230
me3s(10,7) = t236
me3s(1,4) = t242
me3s(4,10) = t150
me3s(5,6) = t53
me3s(6,1) = t248
me3s(6,2) = t254
me3s(10,2) = t260
me3s(8,9) = t88
me3s(6,7) = t109
me3s(10,8) = t266
me3s(1,5) = t274
me3s(9,10) = t115
me3s(5,7) = t230
me3s(5,4) = t280
me3s(7,8) = t24
me3s(7,4) = t286
me3s(9,4) = t138
me3s(1,3) = t159
me3s(8,10) = t266
me3s(6,8) = t292
me3s(9,1) = t298
me3s(1,6) = t248
me3s(5,8) = t304
me3s(5,3) = t310
me3s(7,9) = t9
me3s(7,3) = t316
me3s(9,3) = t15
me3s(2,7) = t322
me3s(1,2) = t331
me3s(4,4) = 4*t332*m(10)+4*t332*m(9)+4*t332*m(6)+4*t332*m(5)+4*
+t332*m(7)+J(4)+m(4)*t332+4*t332*m(8)
me3s(4,1) = t242
me3s(6,9) = t59
me3s(8,4) = t352
me3s(4,5) = t280
me3s(3,4) = t82
me3s(5,9) = t224
me3s(5,2) = t358
me3s(7,10) = t236
me3s(7,2) = t322
me3s(9,2) = t364
me3s(2,8) = t370
me3s(1,7) = t376
me3s(6,10) = t183
me3s(8,3) = t382
me3s(4,6) = t388
me3s(3,5) = t310
me3s(2,9) = t364
me3s(7,1) = t376
me3s(1,8) = t72
me3s(5,10) = t66
me3s(2,4) = t192
me3s(8,2) = t370
me3s(4,7) = t286
me3s(3,6) = t212
me3s(2,1) = t331
me3s(1,1) = 4*t389*m(8)+4*t389*m(10)+m(1)*t389+4*t389*m(6)+4*t3
+89*m(9)+4*t389*m(7)+4*t389*m(2)+J(1)+4*t389*m(5)+4*t389*m(4)+4*t38
+9*m(3)
me3s(2,10) = t260
me3s(1,9) = t298
me3s(10,1) = t417
me3s(2,5) = t358
me3s(4,8) = t352
me3s(3,7) = t316
me3s(8,5) = t304
me3s(2,3) = t218
me3s(1,10) = t417
me3s(5,1) = t274
me3s(2,6) = t254
me3s(3,8) = t382
me3s(8,6) = t292
me3s(6,4) = t388
t1 = -th(9)
t4 = 2*m(10)
t5 = m(9)+t4
t8 = r(7)*r(9)*sin(th(7)+t1)*t5
t14 = r(3)*r(9)*sin(th(3)+t1)*t5
t16 = -th(8)
t19 = 2*m(9)
t20 = m(8)+t4+t19
t23 = r(7)*r(8)*sin(th(7)+t16)*t20
t25 = -th(6)
t28 = 2*m(7)
t29 = 2*m(8)
t30 = m(6)+t19+t4+t28+t29
t33 = r(5)*r(6)*sin(th(5)+t25)*t30
t39 = r(6)*r(9)*sin(th(6)+t1)*t5
t41 = -th(10)
t46 = r(5)*m(10)*r(10)*sin(th(5)+t41)
t52 = r(1)*r(8)*sin(th(1)+t16)*t20
t54 = -th(4)
t57 = 2*m(5)
t58 = 2*m(6)
t59 = t29+m(4)+t19+t57+t28+t4+t58
t62 = r(3)*r(4)*sin(th(3)+t54)*t59
t68 = r(8)*r(9)*sin(th(8)+t1)*t5
t70 = -th(7)
t73 = t4+m(7)+t29+t19
t76 = r(6)*r(7)*sin(th(6)+t70)*t73
t82 = r(9)*m(10)*r(10)*sin(th(9)+t41)
t88 = r(4)*r(9)*sin(th(4)+t1)*t5
t94 = r(3)*m(10)*r(10)*sin(th(3)+t41)
t100 = r(4)*m(10)*r(10)*sin(th(4)+t41)
t102 = -th(3)
t105 = 2*m(4)
t106 = t57+t105+t4+t29+t28+m(3)+t19+t58
t109 = r(1)*r(3)*sin(th(1)+t102)*t106
t115 = r(6)*m(10)*r(10)*sin(th(6)+t41)
t121 = r(2)*r(4)*sin(th(2)+t54)*t59
t127 = r(3)*r(6)*sin(th(3)+t25)*t30
t133 = r(2)*r(3)*sin(th(2)+t102)*t106
t140 = r(5)*r(9)*sin(th(5)+t1)*t5
t146 = r(5)*r(7)*sin(th(5)+t70)*t73
t152 = r(7)*m(10)*r(10)*sin(th(7)+t41)
t158 = r(1)*r(4)*sin(th(1)+t54)*t59
t166 = r(1)*r(6)*sin(th(1)+t25)*t30
t172 = r(2)*r(6)*sin(th(2)+t25)*t30
t178 = r(2)*m(10)*r(10)*sin(th(2)+t41)
t186 = r(8)*m(10)*r(10)*sin(th(8)+t41)
t188 = -th(5)
t191 = t58+t29+t19+t28+m(5)+t4
t194 = r(1)*r(5)*sin(th(1)+t188)*t191
t202 = r(4)*r(5)*sin(th(4)+t188)*t191
t209 = r(4)*r(7)*sin(th(4)+t70)*t73
t218 = r(6)*r(8)*sin(th(6)+t16)*t20
t224 = r(1)*r(9)*sin(th(1)+t1)*t5
t231 = r(5)*r(8)*sin(th(5)+t16)*t20
t237 = r(3)*r(5)*sin(th(3)+t188)*t191
t244 = r(3)*r(7)*sin(th(3)+t70)*t73
t251 = r(2)*r(7)*sin(th(2)+t70)*t73
t260 = r(1)*r(2)*sin(th(1)-th(2))*(2*m(3)+m(2)+t105+t28+t4+t57+t58
++t19+t29)
t268 = r(4)*r(8)*sin(th(4)+t16)*t20
t277 = r(2)*r(5)*sin(th(2)+t188)*t191
t285 = r(2)*r(9)*sin(th(2)+t1)*t5
t291 = r(2)*r(8)*sin(th(2)+t16)*t20
t297 = r(1)*r(7)*sin(th(1)+t70)*t73
t304 = r(3)*r(8)*sin(th(3)+t16)*t20
t310 = r(4)*r(6)*sin(th(4)+t25)*t30
t328 = r(1)*m(10)*r(10)*sin(th(1)+t41)
cc3s(9,7) = -2*t8
cc3s(3,9) = 2*t14
cc3s(8,7) = -2*t23
cc3s(2,2) = 0
cc3s(6,5) = -2*t33
cc3s(9,6) = -2*t39
cc3s(10,5) = -2*t46
cc3s(8,1) = -2*t52
cc3s(4,3) = -2*t62
cc3s(9,8) = -2*t68
cc3s(5,5) = 0
cc3s(7,6) = -2*t76
cc3s(10,9) = -2*t82
cc3s(3,3) = 0
cc3s(4,9) = 2*t88
cc3s(3,10) = 2*t94
cc3s(10,4) = -2*t100
cc3s(3,1) = -2*t109
cc3s(8,8) = 0
cc3s(6,6) = 0
cc3s(10,6) = -2*t115
cc3s(10,10) = 0
cc3s(4,2) = -2*t121
cc3s(9,9) = 0
cc3s(7,7) = 0
cc3s(6,3) = -2*t127
cc3s(3,2) = -2*t133
cc3s(10,3) = -2*t94
cc3s(9,5) = -2*t140
cc3s(7,5) = -2*t146
cc3s(10,7) = -2*t152
cc3s(1,4) = 2*t158
cc3s(4,10) = 2*t100
cc3s(5,6) = 2*t33
cc3s(6,1) = -2*t166
cc3s(6,2) = -2*t172
cc3s(10,2) = -2*t178
cc3s(8,9) = 2*t68
cc3s(6,7) = 2*t76
cc3s(10,8) = -2*t186
cc3s(1,5) = 2*t194
cc3s(9,10) = 2*t82
cc3s(5,7) = 2*t146
cc3s(5,4) = -2*t202
cc3s(7,8) = 2*t23
cc3s(7,4) = -2*t209
cc3s(9,4) = -2*t88
cc3s(1,3) = 2*t109
cc3s(8,10) = 2*t186
cc3s(6,8) = 2*t218
cc3s(9,1) = -2*t224
cc3s(1,6) = 2*t166
cc3s(5,8) = 2*t231
cc3s(5,3) = -2*t237
cc3s(7,9) = 2*t8
cc3s(7,3) = -2*t244
cc3s(9,3) = -2*t14
cc3s(2,7) = 2*t251
cc3s(1,2) = 2*t260
cc3s(4,4) = 0
cc3s(4,1) = -2*t158
cc3s(6,9) = 2*t39
cc3s(8,4) = -2*t268
cc3s(4,5) = 2*t202
cc3s(3,4) = 2*t62
cc3s(5,9) = 2*t140
cc3s(5,2) = -2*t277
cc3s(7,10) = 2*t152
cc3s(7,2) = -2*t251
cc3s(9,2) = -2*t285
cc3s(2,8) = 2*t291
cc3s(1,7) = 2*t297
cc3s(6,10) = 2*t115
cc3s(8,3) = -2*t304
cc3s(4,6) = 2*t310
cc3s(3,5) = 2*t237
cc3s(2,9) = 2*t285
cc3s(7,1) = -2*t297
cc3s(1,8) = 2*t52
cc3s(5,10) = 2*t46
cc3s(2,4) = 2*t121
cc3s(8,2) = -2*t291
cc3s(4,7) = 2*t209
cc3s(3,6) = 2*t127
cc3s(2,1) = -2*t260
cc3s(1,1) = 0
cc3s(2,10) = 2*t178
cc3s(1,9) = 2*t224
cc3s(10,1) = -2*t328
cc3s(2,5) = 2*t277
cc3s(4,8) = 2*t268
cc3s(3,7) = 2*t244
cc3s(8,5) = -2*t231
cc3s(2,3) = 2*t133
cc3s(1,10) = 2*t328
cc3s(5,1) = -2*t194
cc3s(2,6) = 2*t172
cc3s(3,8) = 2*t304
cc3s(8,6) = -2*t218
cc3s(6,4) = -2*t310
t2 = 2*m(10)
t3 = 2*m(9)
t9 = 2*m(5)
t10 = 2*m(4)
t11 = 2*m(8)
t12 = 2*m(7)
t13 = 2*m(6)
t39 = 2*m(3)
const(8,1) = g*cos(th(8))*r(8)*(m(8)+t2+t3)
const(3,1) = g*r(3)*cos(th(3))*(t9+t10+t2+t11+t12+m(3)+t3+t13)
const(6,1) = g*r(6)*cos(th(6))*(m(6)+t3+t2+t12+t11)
const(9,1) = g*r(9)*cos(th(9))*(m(9)+t2)
const(4,1) = g*r(4)*cos(th(4))*(t11+m(4)+t3+t9+t12+t2+t13)
const(7,1) = g*r(7)*cos(th(7))*(t2+m(7)+t11+t3)
const(2,1) = g*r(2)*cos(th(2))*(t39+m(2)+t10+t12+t2+t9+t13+t3+t
+11)
const(1,1) = g*r(1)*cos(th(1))*(m(1)+t3+2*m(2)+t10+t39+t11+t12+
+t13+t9+t2)
const(10,1) = m(10)*g*r(10)*cos(th(10))
const(5,1) = g*r(5)*cos(th(5))*(t13+t11+t3+t12+m(5)+t2)
c
do 1000, i =1,n ,1
ydot(i) = th(i+n)
1000 continue
c
c
do 1001, i =1,n ,1
c
do 1002, k =1,n ,1
Const(i,1) = Const(i,1)+CC3S(i,k)*(th(k+n)**2)
1002 continue
c
Const(i,1) = -Const(i,1)
1001 continue
c
c we must solve M z =const
c which gives ydot((n+1)..2*n)
call dlslv(me3s,n,n,Const,n,1,w, rcond,ierr,1)
if (ierr.ne.0) then
write(6,2000)
2000 format('Matrice mal conditionnee')
endif
c
do 1003, i =1,n ,1
ydot(n+i) = const(i,1)
1003 continue
c
return
end